#include <libc.h>
#include <string.h>

void escribe(int n)
{
        char buffer[12];
        if(n < 0)
        {
                perror();
        }
        else
        {
                itoa(n, buffer);
                write(1, buffer, strlen(buffer));
        }
        write(1, "\n", 1);
}

int __attribute__ ((__section__(".text.main")))
  main(void)
{
	//runjp();

	char buffer[256];
	int pid, fd1, fd2, i;
	pid = fork();

	if(pid == 0)
	{
		fd1 = open("aaa", O_CREAT | O_RDWR);
		fd2 = open("aaa", O_RDWR);
		escribe(fd1);
		escribe(fd2);
		write(fd1, "NINJAAAAAAAA", strlen("NINJAAAAAAAA"));
		read(fd2, buffer, strlen("NINJAAAAAAAA"));
		write(1, buffer, strlen("NINJAAAAAAAA"));
	}

	while(1);
	return 0;
}
